<template>
	<view class="">
		<!-- <view class="share-tit">
			<image lazy-load="true"  :src="note_detail.user.base_avatar" class="share-header"></image>
			<view class="header-box">
				<view class="header-tit">{{note_detail.user.base_nickname}}</view>
				<view class="timer">
					<image lazy-load="true"  src="../../static/images/time-1.png" class="time-img"></image>
					<view class="">{{ utils.friendlyDate(note_detail.create_time*1000) }}</view>
				</view>
			</view>
		</view> -->
		<view v-if="note_detail.is_del == 1" >
			<image style="width: 750upx;" src="../../static/images/notedel.png" mode="aspectFit"></image>
		</view>
		<view v-if="note_detail.is_del !== 1">
		<view class="banner">
			<block v-if="!video_play">
				<swiper :indicator-dots="true" indicator-active-color="gray" indicator-color="#cccccc" :autoplay="true"  class="banner-img">
					<swiper-item v-for="(item,key) in note_detail.image" :key="key">
						<image class="banner-img" lazy-load="true" :src="item"  @click="showSlider(item)" mode="scaleToFill"></image>
					</swiper-item>
				</swiper>
				<image src="../../static/images/has_video.png" @click="paly_video" v-if="note_detail.video" class="has_video"></image>
			</block>
			<view class="banner"  v-if="video_play">
				<view class="close_video" @click="close_video">×</view>
				<video v-if="video_play" class="banner-video" :src="note_detail.video" autoplay="true" controls></video>
			</view>
		</view>
		<view class="msg-box">
			<view class="msg-tit">
				{{note_detail.title}}
			</view>
			<view class="msg-content">
				{{note_detail.content}}
			</view>
	<!-- 		<scroll-view scroll-x="true" >
				<view class="good-img">
					<image lazy-load="true"  v-for="(item,key) in note_detail.image" :key="key" @click="showSlider(item)" :src="item" mode="widthFix" class="item-img"></image>
				</view>
			</scroll-view> -->
			<view class="tips-box">
				<view class="tips-list" v-for="(item,key) in note_detail.topics" :key="key"># {{item}}</view>
			</view>
			<view class="btn-box">
				<view class="data-num">
					<view class="twice">{{ utils.friendlyDate(note_detail.create_time*1000) }}</view>
					<view class="twice" style="margin-left: 40upx;"> 浏览 {{note_detail.scan_count}}次</view>
				</view>
				
				<view class="join">
					<view class="canyu" @click="note_like(note_detail.id)">
						<image lazy-load="true"  v-if="!note_detail.is_like" src="../../static/images/taoxin2.png" class="can-img"></image>
						<image lazy-load="true"  v-if="note_detail.is_like" src="../../static/images/taoxin3.png" class="can-img"></image>
						<view class="ft14">{{note_detail.like_count}}</view>
					</view>
					<view class="collect" @click="note_follow(note_detail.id)">
						<image lazy-load="true"  v-if="!note_detail.is_follow" src="../../static/images/shoucang4.png" class="join-img"></image>
						<image lazy-load="true"  v-if="note_detail.is_follow" src="../../static/images/shoucang3.png" class="join-img"></image>
						<view class="ft14 ftbot">{{note_detail.follow_count}}</view>
					</view>
				</view>
			</view>
			<view class="share-box" @click="showShare()" style="display: none;">
				<view class="">
					<text class="share-msg">分享得元宝：20个</text>
					<text class="share-msg">成单得现金：200元+</text>
				</view>
				<image lazy-load="true"  src="../../static/images/share-img.png" class="share-img"></image>
			</view>
			<view class="comments_empty" v-if="comments_empty">暂无评论，快去评论吧~</view>
			<view  v-if="!comments_empty">
				<view class="comment">共{{comment_list.length}}条评论</view>
				<view class="comment-list" v-for="(item,key) in comment_list" :key="key">
					<view class="comment-main">
						<view class="comment-tit-1"  @click="setCommentId(item.id,item.user.id,item.user.base_nickname)">
							<image lazy-load="true"  :src="item.user.base_avatar" class="comment-img"></image>
							<view class="comment-txt">
								<view class="comment-txt-tit">{{item.user.base_nickname}} <text class="editer" v-if="item.user.id == note_detail.user.id">作者</text></view>
								<view class="comment-txt-msg">{{item.content}}</view>
								<!-- <view class="comment-txt-editer"><view class="editer-bg">作者赞过</view></view> -->
							</view>
						</view>
						<view class="enter" @click="comment_like(item.id)">
							<image lazy-load="true"  v-if="!item.is_like" src="../../static/images/tao.png" class="enter-img"></image>
							<image lazy-load="true"  v-if="item.is_like" src="../../static/images/tao1.png" class="enter-img"></image>
							<!-- <view class="sm">{{item.like_count}}</view> -->
						</view>
					</view>
					<view class="comment-secend">
						<view class="comment-main" v-for="(sub_item,index) in item.sub_list" :key="index" >
							<view class="comment-tit-1" v-if="item.show_comment && (index<2)">
								<image lazy-load="true"  :src="sub_item.user.base_avatar" class="comment-img"></image>
								<view class="comment-txt" @click="setCommentId(item.id,sub_item.user.id,sub_item.user.base_nickname)">
									<view class="comment-txt-tit">{{sub_item.user.base_nickname}} <text class="editer" v-if="sub_item.user.id == note_detail.user.id">作者</text></view>
									<view class="comment-txt-msg">
										<block v-if="sub_item.user.id !== sub_item.reply_user.id">回复 {{sub_item.reply_user.base_nickname}}：</block>
										{{sub_item.content}}
										<!-- <text class="comment-txt-time">16分钟前</text> -->
									</view>
								</view>
							</view>
							<view class="comment-tit-1" v-if="!item.show_comment">
								<image lazy-load="true"  :src="sub_item.user.base_avatar" class="comment-img"></image>
								<view class="comment-txt" @click="setCommentId(item.id,sub_item.user.id,sub_item.user.base_nickname)">
									<view class="comment-txt-tit">{{sub_item.user.base_nickname}} <text class="editer" v-if="sub_item.user.id == note_detail.user.id">作者</text></view>
									<view class="comment-txt-msg">
										<block v-if="sub_item.user.id !== sub_item.reply_user.id">回复 {{sub_item.reply_user.base_nickname}}：</block>
										{{sub_item.content}}
										<!-- <text class="comment-txt-time">16分钟前</text> -->
									</view>
								</view>
							</view>
						<!-- 	<view class="enter" @click="comment_like(sub_item.id)">
								<image lazy-load="true"  v-if="!sub_item.is_like" src="../../static/images/tao.png" class="enter-img"></image>
								<image lazy-load="true"  v-if="sub_item.is_like" src="../../static/images/tao1.png" class="enter-img"></image>
							</view> -->
						</view>						
						<view class="more-msg" v-if="item.sub_list.length>2" v-show="item.show_comment" @click="getMoreComments(item.id)">——展开更多回复</view>
					</view>
				</view>
			</view>
			
			
			<!--  -->
			
		</view>
		<uni-popup ref="popup" type="center" :maskClick="false" style="border-radius: 20upx;">
				<view class="pop-box">
					<view class="pop-tit">
						<view class="">买同款</view>
						<image lazy-load="true"  src="../../static/images/close-btn.png" class="close" @click="closePopup"></image>
					</view>
					<scroll-view class="pop-box-box" scroll-y="true">
						<view class="pop-list" v-for="(item,key) in note_detail.goods" :key="key">
							<view class="pop-left">
								<image lazy-load="true" v-if="!item.checked" @click="select_id(item.id)"  src="../../static/images/uncheck.png" class="uncheck"></image>
								<image lazy-load="true" v-if="item.checked" @click="select_id(item.id)"  src="../../static/images/check.png" class="uncheck"></image>
								<image lazy-load="true"  :src="item.image[0]" class="goods-img"  @click="goDetail(item.id)"></image>
								<view class="good-msg"  @click="goDetail(item.id)">
									<view class="good-tit">{{item.name}}</view>
									<view class="good-detail">{{item.spec}}</view>
									<view class="good-money">￥{{item.real_price}}</view>
								</view>
							</view>
							<view class="pop-right">
								<image lazy-load="true"  src="../../static/images/sale.png" class="sale" @click="payGood(item.id)"></image>
							</view>
						</view>
					</scroll-view>
					<view class="bot-menu">
						<view class="all-box" @click="select_all">
							<image lazy-load="true" v-if="!select_all_s" src="../../static/images/uncheck.png" class="uncheck"></image>
							<image lazy-load="true" v-if="select_all_s" src="../../static/images/check.png" class="uncheck"></image>
							<view class="all-select">全选</view>
						</view>
						<view class="btn-box" @click="follow_goods">
							<image lazy-load="true"  src="../../static/images/shoucang-btn.png" class="shoucang-btn"></image>
						</view>					
					</view>
				</view>
		</uni-popup>
		<!-- #ifdef MP-WEIXIN -->
		<view class="show-msg-box" v-if="isLong" @tap="closeMsgBox" @click="closeMsgBox" @touchmove="closeMsgBox">
			<view class="msg-box-1">
				<textarea  
				:auto-height="true"
				cursor-spacing="40"
				v-on:click.stop="closeMsgBox" 
				v-on:tap.stop="closeMsgBox" 
				v-on:touchmove.stop="closeMsgBox" 
				:focus="isLong" 
				:show-confirm-bar="false" 
				:fixed="true" 
				class="textarea"  
				:placeholder="placeholder_txt" 
				v-model="comments_val"
				maxlength="100">
				</textarea>
				<view class="msg-btn-box">
					<button size="mini" type="default" @click="getCommentsVal">发表</button>
				</view>
			</view>
		</view>
		<!-- #endif -->
		
		<!-- #ifdef H5 -->
		<view class="show-msg-box" v-if="isLong">
			<view class="msg-box-1">
				<textarea  
				cursor-spacing="40"
				:focus="isLong" 
				:show-confirm-bar="false" 
				:fixed="true" 
				class="textarea"  
				:placeholder="placeholder_txt" 
				v-model="comments_val"
				maxlength="100">
				</textarea>
				<view class="msg-btn-box">
					<button size="mini" type="default" @click="closeMsgBox" style="margin-right: 20upx;">关闭</button>
					<button size="mini" type="default" @click="getCommentsVal">发表</button>
				</view>
			</view>
		</view>
		<!-- #endif -->
		<view class="zhan"></view>
		<!-- footer-bar -->
		<view class="footer-bar menu">
			<view class="ping" @click="showLong">
				<image src="../../static/images/shuodian.png" class="ping-ico"></image>
				<view class="">说点什么...</view>
			</view>
			<view class="btn-box-big">
				<view class="share-earn-money" @click="showShare">推广得</view>
				<view class="buy" @click="openPopup">买同款</view>
			</view>
		</view>
		<view class="share-h5-box" @click="hide_share_box" v-if="share_h5_box == 1">
			<image src="../../static/images/share5.png" class="share-h5-img"></image>
		</view>
		<view class="write-box" >
			<image lazy-load="true"  src="../../static/images/huishou.png" @click="goHome()" class="write"></image>
		</view>
		<view class="share-all-box" style="display: none;">
			<view class="share-bg-box">
				<image lazy-load="true"  src="../../static/images/share-bg-img.png" mode="widthFix" class="share-bg"></image>
				<image lazy-load="true"  src="../../static/images/close-2.png" class="close-2" @click="hideShareBox"></image>
				<view class="qrcode-box">
					<image lazy-load="true"  :src="qrcode_url_new" class="qrcode"></image>
					<view class="share-pop-tit">
						<text>面对面</text>
						<text class="mrgin-r">看笔记</text>
					</view>
					<view class="share-text share-text-box">
						好友成单
					</view>
					<view class="share-text">
						即可获得奖励
					</view>
					<view class="shear-btn-box">
						<button open-type="share" class="share-btn-1">
							<image lazy-load="true"  src="../../static/images/share-friend.png" class="share-friend"></image>
						</button>
						<image lazy-load="true"  src="../../static/images/card.png" class="card" @click="goCard"></image>
					</view>
					<view class="smll-size">
						可获得元宝
					</view>
				</view>
			</view>
		</view>
		<tki-qrcode
		style="position: absolute;z-index: -1;top:-2000upx;left: -1000upx;"
		   ref="qrcode"
		   cid="qrcode1"
			:lv= "1"
		   :val="qrcode_url"
		   @result="qrR" />
		   <min-action-sheet ref="as1">
		       <view><button @click="click_share" style="padding: 20upx 0;font-size: 28upx;background-color: #FFFFFF;border: none;border-bottom: none;border-top: none;" open-type="share">转发</button></view>
		   </min-action-sheet>
		   </view>
	</view>
</template>

<script>
	import minActionSheet from '@/components/min-action-sheet/min-action-sheet'
	import tkiQrcode from "@/components/tki-qrcode/tki-qrcode.vue";
	import utils from '@/components/shoyu-date/utils.filter.js';
export default {
  data() {
    return {
		indicatorDots: false,
		autoplay: false,
		select_all_s: false,
		video_play: false,
		share_h5_box: 0,
		interval: 5000,
		duration: 500,
		current:0,
        popNum:1,
		showShareBox:0,
		qrcode_url:'',
		qrcode_url_new:'',
		isLong:false,
		keyNum:0,
		note_id:0,
		note_detail:{},
		ts:'',
		per:20,
		comments_empty:true,
		comments_val:'',
		parent_id:0,
		reply_user_id:0,
		utils:utils,
		comment_list:[],
		placeholder_txt:'请输入你的评论~',
		user_obj:{},
		stauts_code:0,
		follow_list:[]
		}
  },
  onLoad(e) {
	  var self = this; 
	this.note_id = e.id;
	// uni.setStorageSync('share_id',e.share);
	// uni.setStorageSync('note_id',e.id);	
  },
  onShow() {
	  var self = this; 
	  self.select_all_s=false;
	  self.$request.request({
	  	url:'/user/info',
	  	success:function(res){
	  		self.stauts_code = res.code
			console.log(res)
			if(res.code == 200){
				let user_id_s = res.result.id;
				let share_id = uni.getStorageSync('share_id') ? uni.getStorageSync('share_id') : 0;
				if(user_id_s && share_id){
					self.$request.request({
						url:'/user/set_bind',
						data:{
							send_user_id:share_id,
							receive_user_id:user_id_s
						},
						success:function(res){
							
						}
					});
				}
			}
	  	}
	  });
	  this.share_h5_box=0;
  	this.$request.request({
  		url:'/note/detail',
  		data:{
  			note_id:this.note_id
  		},
  		success:function(res){
  			if(res.code==200){
  				var x = res.result;
  				console.log(x)
  				x.image.forEach((item,index)=>{
  					x.image[index] =self.$http_img(item);
  				});
  				x.goods.forEach((item,index)=>{
  					x.goods[index].image = JSON.parse(x.goods[index].image);
  					x.goods[index].image[0] =self.$http_img(item.image[0]);
  					x.goods[index].real_price = self.$money(x.goods[index].real_price);
  					x.goods[index].checked = false;
  				});
  				self.note_detail = x;
  				self.getComments();
  				self.user_obj = uni.getStorageSync('user');
				
				
				// #ifdef MP-WEIXIN
				self.qrcode_url = self.$request.share_url+'?page=note&id='+self.note_id+'&share='+(self.user_obj ? self.user_obj.id : 0);
				// #endif
  				
  				
				
				// #ifdef H5
				
				self.qrcode_url = self.$request.h5_share_url+'?page=share-details&share='+(self.user_obj ? self.user_obj.id : 0)+'&id='+self.note_id;
				let share_time_line={
					title:x.title, // 分享标题
					link: self.$request.h5_share_url+'?page=share-details&share='+(self.user_obj ? self.user_obj.id : 0)+'&id='+self.note_id, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
					imgUrl: self.$request.h5_img_url+'/static/images/logo.png', // 分享图标
				}
				let share_app_message={
					title: x.title, // 分享标题
					desc: x.content, // 分享描述
					link: self.$request.h5_share_url+'?page=share-details&share='+(self.user_obj ? self.user_obj.id : 0)+'&id='+self.note_id, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
					imgUrl: self.$request.h5_img_url+'/static/images/logo.png', // 分享图标
				}
				uni.setStorageSync('share_time_line',share_time_line);
				uni.setStorageSync('share_app_message',share_app_message);
				self.$request.wx_config()
				// #endif
				
				
  			}else{
  				
  			}
  		}
  	});
  },
   onShareAppMessage(res) {
	   var self = this;
      if (res.from === 'button') {// 来自页面内分享按钮
        console.log(res.target)
      }
      return {
        title:self.note_detail.title ,
		imageUrl:self.note_detail.goods[0].image[0],
        path: '/pages/share-details/share-details?id='+self.note_id+'&share='+( uni.getStorageSync('user') ? uni.getStorageSync('user').id : 0)
      }
    },
  components: {tkiQrcode,minActionSheet},
  methods: {
    openPopup(){
        this.$refs.popup.open()
    },
	closePopup(){
		this.$refs.popup.close()
	},
	showShare(){
		var self = this;
		if(this.stauts_code == 40003){
			uni.navigateTo({
				url:'../login/login?page=share-details&id='+self.note_id
			})
		}else{
			this.$refs.qrcode._makeCode();
			this.$refs.as1.handleShow({
				actions: [
				  {
					name: '生成海报',
					color: '#000000',
					loading: 0
				  }
				],
				success: (res) => {
				  switch (res.id) {
					// -1代表取消按钮
					case -1:
					  
					  break
					// 代表异步按钮
					case 0:
					  res.handleHide();
					  this.$request.request({
					  	url:'/share/goods',
					  	data:{
					  		store_sku_id:this.store_sku_id,
					  	},
					  	success:function(res){
					  		
					  	}
					  });
					  this.goCard();
					  break
				  }
				}
			  })
			
		}
	},
	hide_share_box(){
		this.share_h5_box = 0;
	},
	click_share(){
		this.$refs.as1.handleHide();
		// #ifdef H5
		this.share_h5_box = 1;
		// #endif
		// #ifdef MP-WEIXIN
		this.$request.request({
			url:'/share/goods',
			data:{
				store_sku_id:this.store_sku_id,
			},
			success:function(res){
				
			}
		});
		// #endif
		
	},
	select_id(id){
		var self = this;
		self.note_detail.goods.forEach((item,index)=>{
			if(item.id == id){
				if(item.checked){
					item.checked = false;
					var toppicIndex = self.follow_list.indexOf(id);
					self.follow_list.splice(toppicIndex,1);
					self.select_all_s=false;
				}else{
					item.checked = true;
					self.follow_list.push(id)
				}
			}
		});
	},
	select_all(){
		var self = this;
		if(self.select_all_s){
			self.select_all_s = false;
			self.follow_list=[];
			self.note_detail.goods.forEach((item,index)=>{
				item.checked = false;
			});
		}else{
			self.note_detail.goods.forEach((item,index)=>{
				self.follow_list.push(item.id);
				self.select_all_s = true;
				item.checked = true;
			});
		}
	},
	goHome(){
		uni.switchTab({
		    url: '/pages/index/index'
		});
	},
	follow_goods(){
		var self = this;
		var list = this.follow_list.length;
		if(list==0){
			uni.showToast({
				title:'请先选择要收藏的商品',
				icon:'none'
			})
		}else{			
			this.$request.request({
				url:'/goods/follow',
				data:{
					store_sku_id: this.follow_list[0]
				},
				success:function(res){
					if(res.code==40003){
						uni.navigateTo({
							url:'../login/login?page=share-details&id='+self.note_id
						});
					}else if(res.code==200){
						for(var a=1;a<list;a++){
							self.$request.request({
								url:'/goods/follow',
								data:{
									store_sku_id: self.follow_list[a]
								},
								success:function(res){
									
								}
							})
						}
						setTimeout(function(){
							uni.showToast({
								title:"收藏成功~",
								icon:'none',
								duration:2000
							});
						},1000)	
						
					}
				}
			})
		}
	},
	hideShareBox(){
		this.showShareBox=0
	},
	payGood(id){
		uni.navigateTo({
		    url: '../shopping-cart/shopping-cart?id='+id+'&num=1'
		});
	},
	goDetail(id){
		uni.navigateTo({
		    url: '../local-store-item/local-store-item?id='+id
		});
	},
	goCard(){	
		// #ifdef MP-WEIXIN
		uni.navigateTo({
		    url: '../canvas/canvas?url='+encodeURIComponent(this.qrcode_url)+'&base_avatar='+encodeURIComponent(this.note_detail.user.base_avatar)+'&base_nickname='+encodeURIComponent(this.note_detail.user.base_nickname)+'&title='+encodeURIComponent(this.note_detail.title)+'&content='+encodeURIComponent(this.note_detail.content)+'&img_url='+encodeURIComponent(this.note_detail.goods[0].image[0])
		});
		// #endif
		// #ifdef H5
		uni.navigateTo({
		    url: '../canvas_h5/canvas_h5?url='+encodeURIComponent(this.qrcode_url)+'&base_avatar='+encodeURIComponent(this.note_detail.user.base_avatar)+'&base_nickname='+encodeURIComponent(this.note_detail.user.base_nickname)+'&title='+encodeURIComponent(this.note_detail.title)+'&content='+encodeURIComponent(this.note_detail.content)+'&img_url='+encodeURIComponent(this.note_detail.goods[0].image[0])
		});
		// #endif
		
	},
	paly_video(){
		this.video_play = true;
	},
	close_video(){
		this.video_play = false;
	},
	showLong(){
		var self = this;
		if(this.stauts_code == 40003){
			uni.navigateTo({
				url:'../login/login?page=share-details&id='+self.note_id
			})
		}else{
			this.parent_id = 0;
			this.reply_user_id = 0;
			 this.isLong = true;
			 this.placeholder_txt='请输入你的评论~'
		}	
	},
	qrR(e){
		console.log(e)
		this.qrcode_url_new = e;
		this.showShareBox = 1;
	},
	showSlider(url){
		uni.previewImage({
			urls:this.note_detail.image,
			current:url
		})
	},
	setCommentId(id,userId,name){
		var self = this;
		if(this.stauts_code == 40003){
			uni.navigateTo({
				url:'../login/login?page=share-details&id='+self.note_id
			})
		}else{
			this.parent_id = id;
			this.reply_user_id = userId;
			this.placeholder_txt='回复'+name+':';
			this.isLong = true;
		}
	},
	getMoreComments(id){
		var self = this;
		self.$request.request({
			url:'/note/sub_comments',
			data:{
				comment_id:id,
				ts:0,
				per:10000000
			},
			success:function(res){
				if(res.code==200){
					var  y = res.result;
					self.comment_list.forEach((item,index)=>{	
						if(item.id == id){
							console.log('ID:'+id+'   itemid:'+item.id);
							self.comment_list[index].sub_list = y;
							self.comment_list[index].show_comment = false;
						}
					})
				}else{
					
				}
			}
		});
	},
	getComments(){
		var self = this;
		self.$request.request({
			url:'/note/comments',
			data:{
				note_id:self.note_id,
				ts:0,
				per:1000000
			},
			success:function(res){
				if(res.code==200){
					var  y = res.result;
					y.forEach((item,index)=>{
						y[index].show_comment = true
					})
					if(y.length==0){
						self.comments_empty = true;
					}else{
						self.comment_list = y;
						self.comments_empty = false;
					}
				}else{
					
				}
			}
		});
	},
	note_like(id){
		var self = this;
		if(!self.note_detail.is_like){
			self.$request.request({
				url:'/note/like',
				data:{
					note_id:id
				},
				success:function(res){
					if(res.code==200){
						uni.showToast({
							title:'点赞成功~',
							icon:'none',
							duration:2000
						});
						self.note_detail.like_count++;
						self.note_detail.is_like=true;
					}else if(res.code==40003){
						uni.navigateTo({
							url:'../login/login?page=share-details&id='+self.note_id
						})
					}
				}
			});
		}	
	},
	note_follow(id){
		var self = this;
		if(!self.note_detail.is_follow){
			self.$request.request({
				url:'/note/follow',
				data:{
					note_id:id
				},
				success:function(res){
					if(res.code==200){
						uni.showToast({
							title:'收藏成功~',
							icon:'none',
							duration:2000
						});
						self.note_detail.follow_count++;
						self.note_detail.is_follow=true;
					}else if(res.code==40003){
						uni.navigateTo({
							url:'../login/login?page=share-details&id='+self.note_id
						})
					}
				}
			});
		}else{
			self.$request.request({
				url:'/note/unfollow',
				data:{
					note_id:id
				},
				success:function(res){
					if(res.code==200){
						uni.showToast({
							title:'取消成功~',
							icon:'none',
							duration:2000
						});
						self.note_detail.follow_count--;
						self.note_detail.is_follow=false;
					}else if(res.code==40003){
						uni.navigateTo({
							url:'../login/login?page=share-details&id='+self.note_id
						})
					}
				}
			});
		}
	},
	comment_like(id){
		var self = this;
		self.comment_list.forEach((item,index)=>{
			if(item.id==id){
				if(item.is_like==false){
					self.$request.request({
						url:'/note/comment/like',
						data:{
							comment_id:id
						},
						success:function(res){
							if(res.code==200){
								uni.showToast({
									title:'点赞成功~',
									icon:'none',
									duration:2000
								});
								self.comment_list[index].is_like=true
							}else if(res.code==40003){
								uni.navigateTo({
									url:'../login/login?page=share-details&id='+self.note_id
								})
							}
						}
					});
				}	
			}
		})
	},
	getCommentsVal(){
		var self = this;
		if(this.comments_val==''){
			return false;
		}
		self.$request.request({
			url:'/note/comment',
			data:{
				note_id:self.note_id,
				content:self.comments_val,
				parent_id:self.parent_id,
				reply_user_id:self.reply_user_id
			},
			success:function(res){
				if(res.code==200){
					uni.showToast({
						title:'评论成功~',
						icon:'none',
						duration:2000
					});
					self.comments_val="";
					self.isLong=false;
					self.getComments()
				}else{
					
				}
			}
		});
	},
	closeMsgBox(){
		this.isLong = false;
	}		
	
    
  },
  created() {
  	
  }
}
</script>
<style>
    @import url("share-details.css");
</style>